package com.bdsy.business.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bdsy.business.dao.ZlOrderDetailsMapper;
import com.bdsy.business.model.ZlOrderDetails;
import com.bdsy.business.service.ZlOrderDetailsService;

@Service("zlOrderDetailsService")
public class ZlOrderDetailsServiceImpl implements ZlOrderDetailsService {

	@Autowired
	ZlOrderDetailsMapper zlOrderDetailsMapper;

	@Override
	public boolean insert(ZlOrderDetails zlOrderDetails) {
		zlOrderDetails.setId((int)((Math.random()*9+1)*10000000));
		zlOrderDetails.setStatus(0);
		int result = zlOrderDetailsMapper.insert(zlOrderDetails);
		return result>0?true:false;
	}

	@Override
	public boolean insertZlOrderDetails(List<ZlOrderDetails> listZlOrderDetails) {
		for (ZlOrderDetails zlOrder : listZlOrderDetails) {
			zlOrder.setId((int)((Math.random()*9+1)*10000000));
			zlOrder.setStatus(0);
		}
		int result = zlOrderDetailsMapper.insertZlOrderDetails(listZlOrderDetails);
		return result>0?true:false;
	}

	@Override
	public boolean deleteZlOrderDetailsById(List<String> pIds) {
		int result = zlOrderDetailsMapper.deleteZlOrderDetailsById(pIds);
		return result>0?true:false;
	}

	@Override
	public boolean updateZlOrderDetailsStatus(ZlOrderDetails zlOrderDetails) {
		int result = zlOrderDetailsMapper.updateZlOrderDetailsStatus(zlOrderDetails);
		return result>0?true:false;
	}

	@Override
	public boolean updateZlOrderDetailStatus(ZlOrderDetails zlOrderDetails) {
		int result = zlOrderDetailsMapper.updateZlOrderDetailStatus(zlOrderDetails);
		return result>0?true:false;
	}

}
